<template>
    <div class="notice-list h-100">
        <el-card class="box-card-details" shadow="never">
            <div slot="header" class="clearfix">
                <div class="fl">
                    <span></span>
                    <h3 style="line-height:40px;">新闻公告</h3>
                </div>
                <div class="fr">
                    <el-button @click="goback"><i class="el-icon-back"></i>返回</el-button>
                </div>
            </div>
            <div class="study-details-body">
                <el-table
                    ref="table"
                    :data="tableData"
                    stripe
                    border
                    style="width: 100%">
                    <el-table-column
                    type="selection"
                    width="55">
                    </el-table-column>
                    <el-table-column
                    label="标题"
                    align="left"
                    prop="AnsTitle"
                    :show-overflow-tooltip="true"
                    min-width="160">
                        <template slot-scope="scope">
                            <el-button type="text" size="mini" @click="lookdes(scope.row)">{{scope.row.AnsTitle}}</el-button>
                        </template>
                    </el-table-column>
                    <el-table-column
                    prop="AnsDate"
                    align="left"
                    label="接收时间"
                    width="180">
                    </el-table-column>
                    <el-table-column
                    align="left"
                    prop="RehabilitationContent"
                    label="状态"
                    width="100">
                    </el-table-column>
                    <!-- <el-table-column
                    label="操作"
                    min-width="130">
                        <template slot-scope="scope">
                            <el-button  @click="handleClickedit(scope.row)" type="text" size="small"><i class="el-icon-edit"></i>编辑</el-button>
                            <el-button  @click="handleClickdelete(scope.row)" type="text" size="small"><i class="el-icon-delete"></i>删除</el-button>
                        </template>
                    </el-table-column> -->
                </el-table>
                <div class="bottom-pages clearfix">
                    <div class="fr">
                        <el-pagination
                        background
                        @size-change="handleSizeChange"
                        @current-change="handleCurrentChange"
                        :current-page="currentPage"
                        :page-sizes="[10, 20, 30, 40]"
                        :page-size="pageSize"
                        :pager-count="5"
                        layout="total, sizes, prev, pager, next"
                        :total="count">
                        </el-pagination>
                    </div>
                </div>
            </div>
        </el-card>
    </div>
</template>

<script>
import {getAnnouncementsAll} from '@/api/index.js'

export default {
    name: 'noticelist',
    components: {
    },
    data() {
        return {
            tableData:[],
            currentPage:1,
            count:0,
            pageSize:10,
            tableSelection:[],
            DISABILITY:[],
            studyInfo:{},
            syudyid:'',
            rehabilitationInfo:''
        }
    },
    created(){
        this._getstudyRehabilitationInfo();
    },
    methods:{

        _getstudyRehabilitationInfo() {
            getAnnouncementsAll({
                bRead:1, 
                bPage:(this.currentPage - 1) * this.pageSize + 1,
                bPage1:this.currentPage * this.pageSize
                }).then((res) => {
                if(res) {
                    console.log(res)
                    this.tableData = res.tableData;
                    // this.count = res.total_rows;
                }
            })
        },

        handleSelectionChange(row){
            console.log(row)
            this.tableSelection = row;
        },
        handleSizeChange(val){
            this.pageSize = val;
            this._getstudyRehabilitationInfo()
        },
        handleCurrentChange(val){
            this.currentPage = val;
            this._getstudyRehabilitationInfo()
        },
        lookdes(row) {
            this.$router.push({path:'/home/notice-des',query:{bAnsID:row.AnsID,bTaskID:row.TaskID,flag:1}})
        },
        // 返回页面
        goback(){
            this.$router.push({path:'/home'})
        },

    }
}
</script>
<style lang="less">
.notice-list{
    .box-card-details{
        height: 100%;
        box-sizing: border-box;
        .el-card__header{
            padding: 10px 20px;
            line-height: 40px;
        }
    }
    h3{
        line-height: 60px;
    }
}
</style>
